DevJourney

NodeJS/geeksforgeekstutorial/Http Server/Split Query/server.js

var http = require('http');
var url = require('url');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  var q = url.parse(req.url, true).query;
  var txt = q.year + " " + q.month;
  res.end(txt);
}).listen(8080);

/* Visit http://localhost:8080/?year=2017&month=July */
View on GitHub